<template>
	<view>
		<login-box-phone @inputPhone="inputPhone"></login-box-phone>
		<login-box-code :phone="phone" @changeYzm="changeYzm"></login-box-code>
		<login-box-pwd @changePwd="changePwd"></login-box-pwd>

		<my-bottom-btn :title="btnTitle" @clickBtn="clickBtn"></my-bottom-btn>
	</view>
</template>

<script>
	import loginBoxPhone from '@/components/content/login/login-box-phone.vue'
	import loginBoxCode from './child/send-code.vue'
	import loginBoxPwd from '@/components/content/login/login-box-pwd.vue'
	import myBottomBtn from '@/components/common/my-bottom-btn/my-bottom-btn.vue'

	import {
		forwardPwd
	} from '@/api/http/login/login.js'

	export default {
		components: {
			loginBoxCode,
			loginBoxPhone,
			loginBoxPwd,
			myBottomBtn
		},
		data() {
			return {
				title_1: '手机号',
				default_1: '填写你的手机号',
				phone: '',
				code: '',
				pwd: '',
				btnTitle: '修改新密码'
			}
		},
		methods: {
			//1，输入手机号
			inputPhone(e) {
				this.phone = e
			},
			//2，输入验证码
			changeYzm(e) {
				this.code = e
			},
			//3，输入密码时
			changePwd(e) {
				this.pwd = e
			},
			//4，修改新密码
			clickBtn() {
				forwardPwd(this.code, this.pwd, this.phone).then(res => {
					if (res.data.pubInfo.code !== 0) {
						return uni.$showMsg(res.data.pubInfo.message);
					}
					uni.$showMsg('修改密码成功！')
				})
			}
		}
	}
</script>

<style>

</style>
